/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package centralehotel.modele;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mathieu
 */
@Entity
@Table(name = "fiche_hotel")
@NamedQueries({@NamedQuery(name = "FicheHotel.findByIdFicheHotel", query = "SELECT f FROM FicheHotel f WHERE f.idFicheHotel = :idFicheHotel"), @NamedQuery(name = "FicheHotel.findByNom", query = "SELECT f FROM FicheHotel f WHERE f.nom = :nom"), @NamedQuery(name = "FicheHotel.findByAdresse", query = "SELECT f FROM FicheHotel f WHERE f.adresse = :adresse"), @NamedQuery(name = "FicheHotel.findByDescription", query = "SELECT f FROM FicheHotel f WHERE f.description = :description"), @NamedQuery(name = "FicheHotel.findByServices", query = "SELECT f FROM FicheHotel f WHERE f.services = :services"), @NamedQuery(name = "FicheHotel.findByNbChambreSimple", query = "SELECT f FROM FicheHotel f WHERE f.nbChambreSimple = :nbChambreSimple"), @NamedQuery(name = "FicheHotel.findByNbChambreDouble", query = "SELECT f FROM FicheHotel f WHERE f.nbChambreDouble = :nbChambreDouble"), @NamedQuery(name = "FicheHotel.findByNbSuite", query = "SELECT f FROM FicheHotel f WHERE f.nbSuite = :nbSuite")})
public class FicheHotel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "id_fiche_hotel", nullable = false)
    private Integer idFicheHotel;
    @Column(name = "nom")
    private String nom;
    @Column(name = "adresse")
    private String adresse;
    @Column(name = "description")
    private String description;
    @Column(name = "services")
    private String services;
    @Column(name = "nb_chambre_simple")
    private Integer nbChambreSimple;
    @Column(name = "nb_chambre_double")
    private Integer nbChambreDouble;
    @Column(name = "nb_suite")
    private Integer nbSuite;
    @OneToMany(mappedBy = "ficheHotel",cascade={ CascadeType.PERSIST , CascadeType.REMOVE })
    private Collection<Chambre> chambreCollection;
    @JoinColumn(name = "gestionnaire_hotel", referencedColumnName = "id_gestionnaire_hotel")
    @ManyToOne
    private GestionnaireHotel gestionnaireHotel;

    @JoinColumn(name = "ville", referencedColumnName = "id_ville")
    @ManyToOne(cascade=CascadeType.PERSIST)
    private Ville ville;

    @OneToMany(mappedBy = "ficheHotel",cascade={ CascadeType.PERSIST , CascadeType.REMOVE } )
    private Collection<PeriodeTarif> periodeTarifCollection;

    public FicheHotel() {
    }

    public FicheHotel(Integer idFicheHotel) {
        this.idFicheHotel = idFicheHotel;
    }

    public Integer getIdFicheHotel() {
        return idFicheHotel;
    }

    public void setIdFicheHotel(Integer idFicheHotel) {
        this.idFicheHotel = idFicheHotel;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getServices() {
        return services;
    }

    public void setServices(String services) {
        this.services = services;
    }

    public Integer getNbChambreSimple() {
        return nbChambreSimple;
    }

    public void setNbChambreSimple(Integer nbChambreSimple) {
        this.nbChambreSimple = nbChambreSimple;
    }

    public Integer getNbChambreDouble() {
        return nbChambreDouble;
    }

    public void setNbChambreDouble(Integer nbChambreDouble) {
        this.nbChambreDouble = nbChambreDouble;
    }

    public Integer getNbSuite() {
        return nbSuite;
    }

    public void setNbSuite(Integer nbSuite) {
        this.nbSuite = nbSuite;
    }

    public Collection<Chambre> getChambreCollection() {
        return chambreCollection;
    }

    public void setChambreCollection(Collection<Chambre> chambreCollection) {
        this.chambreCollection = chambreCollection;
    }

    public GestionnaireHotel getGestionnaireHotel() {
        return gestionnaireHotel;
    }

    public void setGestionnaireHotel(GestionnaireHotel gestionnaireHotel) {
        this.gestionnaireHotel = gestionnaireHotel;
    }

    public Ville getVille() {
        return ville;
    }

    public void setVille(Ville ville) {
        this.ville = ville;
    }

    public Collection<PeriodeTarif> getPeriodeTarifCollection() {
        return periodeTarifCollection;
    }

    public void setPeriodeTarifCollection(Collection<PeriodeTarif> periodeTarifCollection) {
        this.periodeTarifCollection = periodeTarifCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFicheHotel != null ? idFicheHotel.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FicheHotel)) {
            return false;
        }
        FicheHotel other = (FicheHotel) object;
        if ((this.idFicheHotel == null && other.idFicheHotel != null) || (this.idFicheHotel != null && !this.idFicheHotel.equals(other.idFicheHotel))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "centralehotel.modele.FicheHotel[idFicheHotel=" + idFicheHotel + "]";
    }

}
